{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "f95b6759-533a-470b-8f08-5f91ebcea625",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cupy as cp\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import time\n",
    "import zarr\n",
    "\n",
    "import kvikio.nvcomp\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "d1e60a9b-0bca-4c66-b2f0-829acc3b1ba2",
   "metadata": {
    "scrolled": true,
    "tags": []
   },
   "outputs": [],
   "source": [
    "# conda install -c conda-forge zarr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "2cedb529-c0fa-4883-a2fd-78b1ad3c1a59",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2013929216, 1006964608, 503482304, 251741152, 125870576, 62935288, 31467644, 15733822, 7866911, 3933455, 1966727, 983363, 491681, 245840, 122920, 61460, 30730, 15365, 7682, 3841]\n"
     ]
    }
   ],
   "source": [
    "HOST_LZ4_MAX = 2013929216 # 2113929216\n",
    "sizes = list(map(lambda x: HOST_LZ4_MAX//(2**x), np.arange(20)))\n",
    "print(sizes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "39483573-e79b-4dca-aee3-13bf392da3a7",
   "metadata": {},
   "outputs": [],
   "source": [
    "input_size = []\n",
    "cascaded_size = []\n",
    "cascaded_temp_size = []\n",
    "cascaded_round_trip_time = []\n",
    "lz4_gpu_size = []\n",
    "lz4_gpu_temp_size = []\n",
    "lz4_gpu_round_trip_time = []\n",
    "bitcomp_gpu_size = []\n",
    "bitcomp_gpu_temp_size = []\n",
    "bitcomp_gpu_round_trip_time = []\n",
    "lz4_size = []\n",
    "lz4_round_trip_time = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "ccd9b1e7-b607-4948-8256-73bedf1ec7a8",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "821.61s - pydevd: Sending message related to process being replaced timed-out after 5 seconds\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "--2023-09-29 13:44:43--  http://textfiles.com/etext/NONFICTION/kjv10.txt\n",
      "Resolving textfiles.com (textfiles.com)... 208.86.224.90\n",
      "Connecting to textfiles.com (textfiles.com)|208.86.224.90|:80... connected.\n",
      "HTTP request sent, awaiting response... 200 OK\n",
      "Length: 4432803 (4.2M) [text/plain]\n",
      "Saving to: ‘kjv10.txt.2’\n",
      "\n",
      "kjv10.txt.2         100%[===================>]   4.23M   316KB/s    in 14s     \n",
      "\n",
      "2023-09-29 13:44:58 (304 KB/s) - ‘kjv10.txt.2’ saved [4432803/4432803]\n",
      "\n"
     ]
    }
   ],
   "source": [
    "!wget http://textfiles.com/etext/NONFICTION/kjv10.txt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "4c9a5c4c-4c49-4834-8dc2-3e6fc11ea930",
   "metadata": {},
   "outputs": [],
   "source": [
    "text = open('kjv10.txt').read()\n",
    "bib = np.frombuffer(bytes(text, 'utf-8'), dtype=np.int8)\n",
    "data_buffer = np.tile(bib, 500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "74740819-b987-4012-ba6c-ed3d3b9afd60",
   "metadata": {},
   "outputs": [],
   "source": [
    "# One of the three below keys, this will set the arrangement of test data for a full run of the notebook.\n",
    "TARGET = \"Ascending\"\n",
    "DTYPE = cp.int32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "0a1307ed-034c-4943-a7e1-36665cba8ad5",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = {\n",
    "    \"Ascending\": np.arange(0, HOST_LZ4_MAX, dtype=np.int32),\n",
    "    \"Random\": np.random.randint(0, 100, HOST_LZ4_MAX, dtype=np.int32),\n",
    "    \"Text\": data_buffer\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "68adbb33-ddb7-4603-8863-fdd25b8bdc51",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_host_data(offset, dtype):\n",
    "    exemplar = np.array([1], dtype=dtype)\n",
    "    print(offset)\n",
    "    print(exemplar.itemsize)\n",
    "    print(data[TARGET].itemsize)\n",
    "    index = offset // data[TARGET].itemsize\n",
    "    index = index - (index % exemplar.itemsize)\n",
    "    print(index)\n",
    "    return data[TARGET][0:index].view(dtype)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "f067cdc2-ee14-4258-b89d-0bb4a224c698",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2013929216\n",
      "4\n",
      "4\n",
      "503482304\n",
      "-----\n",
      "Input size:  2013929216\n",
      "Cascaded GPU compressor output size:  33434464\n",
      "Cascaded GPU decompressor output size:  2013929216\n",
      "Cascaded GPU compress/decompress round trip time:  0.1076362133026123\n",
      "2021826967\n",
      "Lz4 zarr time:  4.681669235229492\n",
      "Lz4 compressed size:  2021826967\n",
      "1006964608\n",
      "4\n",
      "4\n",
      "251741152\n",
      "-----\n",
      "Input size:  1006964608\n",
      "Cascaded GPU compressor output size:  16717276\n",
      "Cascaded GPU decompressor output size:  1006964608\n",
      "Cascaded GPU compress/decompress round trip time:  0.11769247055053711\n",
      "1010913478\n",
      "Lz4 zarr time:  2.57978892326355\n",
      "Lz4 compressed size:  1010913478\n",
      "503482304\n",
      "4\n",
      "4\n",
      "125870576\n",
      "-----\n",
      "Input size:  503482304\n",
      "Cascaded GPU compressor output size:  8358716\n",
      "Cascaded GPU decompressor output size:  503482304\n",
      "Cascaded GPU compress/decompress round trip time:  0.05775332450866699\n",
      "505456734\n",
      "Lz4 zarr time:  1.2365527153015137\n",
      "Lz4 compressed size:  505456734\n",
      "251741152\n",
      "4\n",
      "4\n",
      "62935288\n",
      "-----\n",
      "Input size:  251741152\n",
      "Cascaded GPU compressor output size:  4179436\n",
      "Cascaded GPU decompressor output size:  251741152\n",
      "Cascaded GPU compress/decompress round trip time:  0.0284881591796875\n",
      "252728362\n",
      "Lz4 zarr time:  0.5986642837524414\n",
      "Lz4 compressed size:  252728362\n",
      "125870576\n",
      "4\n",
      "4\n",
      "31467644\n",
      "-----\n",
      "Input size:  125870576\n",
      "Cascaded GPU compressor output size:  2089796\n",
      "Cascaded GPU decompressor output size:  125870576\n",
      "Cascaded GPU compress/decompress round trip time:  0.01472783088684082\n",
      "126364175\n",
      "Lz4 zarr time:  0.30330395698547363\n",
      "Lz4 compressed size:  126364175\n",
      "62935288\n",
      "4\n",
      "4\n",
      "15733820\n",
      "-----\n",
      "Input size:  62935280\n",
      "Cascaded GPU compressor output size:  1044976\n",
      "Cascaded GPU decompressor output size:  62935280\n",
      "Cascaded GPU compress/decompress round trip time:  0.007399559020996094\n",
      "63182074\n",
      "Lz4 zarr time:  0.1610257625579834\n",
      "Lz4 compressed size:  63182074\n",
      "31467644\n",
      "4\n",
      "4\n",
      "7866908\n",
      "-----\n",
      "Input size:  31467632\n",
      "Cascaded GPU compressor output size:  522532\n",
      "Cascaded GPU decompressor output size:  31467632\n",
      "Cascaded GPU compress/decompress round trip time:  0.004503726959228516\n",
      "31591024\n",
      "Lz4 zarr time:  0.1471562385559082\n",
      "Lz4 compressed size:  31591024\n",
      "15733822\n",
      "4\n",
      "4\n",
      "3933452\n",
      "-----\n",
      "Input size:  15733808\n",
      "Cascaded GPU compressor output size:  261344\n",
      "Cascaded GPU decompressor output size:  15733808\n",
      "Cascaded GPU compress/decompress round trip time:  0.0025734901428222656\n",
      "15795499\n",
      "Lz4 zarr time:  0.03436875343322754\n",
      "Lz4 compressed size:  15795499\n",
      "7866911\n",
      "4\n",
      "4\n",
      "1966724\n",
      "-----\n",
      "Input size:  7866896\n",
      "Cascaded GPU compressor output size:  130716\n",
      "Cascaded GPU decompressor output size:  7866896\n",
      "Cascaded GPU compress/decompress round trip time:  0.0018618106842041016\n",
      "7897736\n",
      "Lz4 zarr time:  0.010539531707763672\n",
      "Lz4 compressed size:  7897736\n",
      "3933455\n",
      "4\n",
      "4\n",
      "983360\n",
      "-----\n",
      "Input size:  3933440\n",
      "Cascaded GPU compressor output size:  65436\n",
      "Cascaded GPU decompressor output size:  3933440\n",
      "Cascaded GPU compress/decompress round trip time:  0.0017323493957519531\n",
      "3948855\n",
      "Lz4 zarr time:  0.028203964233398438\n",
      "Lz4 compressed size:  3948855\n",
      "1966727\n",
      "4\n",
      "4\n",
      "491680\n",
      "-----\n",
      "Input size:  1966720\n",
      "Cascaded GPU compressor output size:  32796\n",
      "Cascaded GPU decompressor output size:  1966720\n",
      "Cascaded GPU compress/decompress round trip time:  0.0020630359649658203\n",
      "1974422\n",
      "Lz4 zarr time:  0.002621889114379883\n",
      "Lz4 compressed size:  1974422\n",
      "983363\n",
      "4\n",
      "4\n",
      "245840\n",
      "-----\n",
      "Input size:  983360\n",
      "Cascaded GPU compressor output size:  16476\n",
      "Cascaded GPU decompressor output size:  983360\n",
      "Cascaded GPU compress/decompress round trip time:  0.0014410018920898438\n",
      "987206\n",
      "Lz4 zarr time:  0.0007197856903076172\n",
      "Lz4 compressed size:  987206\n",
      "491681\n",
      "4\n",
      "4\n",
      "122920\n",
      "-----\n",
      "Input size:  491680\n",
      "Cascaded GPU compressor output size:  8316\n",
      "Cascaded GPU decompressor output size:  491680\n",
      "Cascaded GPU compress/decompress round trip time:  0.0011644363403320312\n",
      "493597\n",
      "Lz4 zarr time:  0.000965118408203125\n",
      "Lz4 compressed size:  493597\n",
      "245840\n",
      "4\n",
      "4\n",
      "61460\n",
      "-----\n",
      "Input size:  245840\n",
      "Cascaded GPU compressor output size:  4236\n",
      "Cascaded GPU decompressor output size:  245840\n",
      "Cascaded GPU compress/decompress round trip time:  0.0015044212341308594\n",
      "246793\n",
      "Lz4 zarr time:  0.0004220008850097656\n",
      "Lz4 compressed size:  246793\n",
      "122920\n",
      "4\n",
      "4\n",
      "30728\n",
      "-----\n",
      "Input size:  122912\n",
      "Cascaded GPU compressor output size:  2184\n",
      "Cascaded GPU decompressor output size:  122912\n",
      "Cascaded GPU compress/decompress round trip time:  0.0011115074157714844\n",
      "123383\n",
      "Lz4 zarr time:  0.0002646446228027344\n",
      "Lz4 compressed size:  123383\n",
      "61460\n",
      "4\n",
      "4\n",
      "15364\n",
      "-----\n",
      "Input size:  61456\n",
      "Cascaded GPU compressor output size:  1148\n",
      "Cascaded GPU decompressor output size:  61456\n",
      "Cascaded GPU compress/decompress round trip time:  0.0009233951568603516\n",
      "61678\n",
      "Lz4 zarr time:  0.00020623207092285156\n",
      "Lz4 compressed size:  61678\n",
      "30730\n",
      "4\n",
      "4\n",
      "7680\n",
      "-----\n",
      "Input size:  30720\n",
      "Cascaded GPU compressor output size:  632\n",
      "Cascaded GPU decompressor output size:  30720\n",
      "Cascaded GPU compress/decompress round trip time:  0.001186370849609375\n",
      "30822\n",
      "Lz4 zarr time:  0.00011777877807617188\n",
      "Lz4 compressed size:  30822\n",
      "15365\n",
      "4\n",
      "4\n",
      "3840\n",
      "-----\n",
      "Input size:  15360\n",
      "Cascaded GPU compressor output size:  360\n",
      "Cascaded GPU decompressor output size:  15360\n",
      "Cascaded GPU compress/decompress round trip time:  0.001523733139038086\n",
      "15401\n",
      "Lz4 zarr time:  0.0003781318664550781\n",
      "Lz4 compressed size:  15401\n",
      "7682\n",
      "4\n",
      "4\n",
      "1920\n",
      "-----\n",
      "Input size:  7680\n",
      "Cascaded GPU compressor output size:  224\n",
      "Cascaded GPU decompressor output size:  7680\n",
      "Cascaded GPU compress/decompress round trip time:  0.0012781620025634766\n",
      "7699\n",
      "Lz4 zarr time:  0.0001780986785888672\n",
      "Lz4 compressed size:  7699\n",
      "3841\n",
      "4\n",
      "4\n",
      "960\n",
      "-----\n",
      "Input size:  3840\n",
      "Cascaded GPU compressor output size:  156\n",
      "Cascaded GPU decompressor output size:  3840\n",
      "Cascaded GPU compress/decompress round trip time:  0.001318216323852539\n",
      "3852\n",
      "Lz4 zarr time:  0.00019931793212890625\n",
      "Lz4 compressed size:  3852\n"
     ]
    }
   ],
   "source": [
    "input_size = []\n",
    "cascaded_size = []\n",
    "cascaded_temp_size = []\n",
    "cascaded_round_trip_time = []\n",
    "lz4_gpu_size = []\n",
    "lz4_gpu_temp_size = []\n",
    "lz4_gpu_round_trip_time = []\n",
    "lz4_size = []\n",
    "lz4_round_trip_time = []\n",
    "for size in sizes:\n",
    "    data_host = get_host_data(size, DTYPE)\n",
    "    data_gpu = cp.array(data_host)\n",
    "    \"\"\"Cascaded GPU\"\"\"\n",
    "    t_gpu = time.time()\n",
    "    compressor = kvikio.nvcomp.CascadedManager(dtype=data_gpu.dtype)\n",
    "    compressed = compressor.compress(data_gpu)\n",
    "    output_size = compressed.nbytes\n",
    "\n",
    "    decompressed = compressor.decompress(compressed)\n",
    "    decompressed_size = decompressed.size * decompressed.itemsize\n",
    "    input_size.append(data_gpu.size * data_gpu.itemsize)\n",
    "    cascaded_round_trip_time.append(time.time() - t_gpu)\n",
    "    cascaded_size.append(output_size)\n",
    "    print('-----')\n",
    "    print('Input size: ', data_gpu.size * data_gpu.itemsize)\n",
    "    print('Cascaded GPU compressor output size: ', output_size)\n",
    "    print('Cascaded GPU decompressor output size: ', decompressed_size)\n",
    "    print('Cascaded GPU compress/decompress round trip time: ',time.time() - t_gpu)\n",
    "    \n",
    "    del compressor\n",
    "        \n",
    "    \"\"\"LZ4 Host\"\"\"\n",
    "    lz4 = zarr.LZ4()\n",
    "    t_host = time.time()\n",
    "    host_compressed = lz4.encode(data_gpu.get())\n",
    "    del data_gpu\n",
    "    print(len(host_compressed))\n",
    "    host_compressed = host_compressed[:2113929216]\n",
    "    host_decompressed = lz4.decode(host_compressed)\n",
    "    print('Lz4 zarr time: ', time.time() - t_host)\n",
    "    print('Lz4 compressed size: ', len(host_compressed))\n",
    "    lz4_size.append(len(host_compressed))\n",
    "    lz4_round_trip_time.append(time.time() - t_host)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "c981e8bc-e96a-4af4-9fe1-414aa2ff4c99",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2013929216\n",
      "4\n",
      "4\n",
      "503482304\n",
      "lz4 GPU compressor output size:  2022340697\n",
      "lz4 GPU decompressor output size:  2013929216\n",
      "lz4 GPU compress/decompress round trip time:  0.7271463871002197\n",
      "1006964608\n",
      "4\n",
      "4\n",
      "251741152\n",
      "lz4 GPU compressor output size:  1011170371\n",
      "lz4 GPU decompressor output size:  1006964608\n",
      "lz4 GPU compress/decompress round trip time:  0.36713171005249023\n",
      "503482304\n",
      "4\n",
      "4\n",
      "125870576\n",
      "lz4 GPU compressor output size:  505585200\n",
      "lz4 GPU decompressor output size:  503482304\n",
      "lz4 GPU compress/decompress round trip time:  0.1900792121887207\n",
      "251741152\n",
      "4\n",
      "4\n",
      "62935288\n",
      "lz4 GPU compressor output size:  252792621\n",
      "lz4 GPU decompressor output size:  251741152\n",
      "lz4 GPU compress/decompress round trip time:  0.09049177169799805\n",
      "125870576\n",
      "4\n",
      "4\n",
      "31467644\n",
      "lz4 GPU compressor output size:  126396327\n",
      "lz4 GPU decompressor output size:  125870576\n",
      "lz4 GPU compress/decompress round trip time:  0.04643416404724121\n",
      "62935288\n",
      "4\n",
      "4\n",
      "15733820\n",
      "lz4 GPU compressor output size:  63198181\n",
      "lz4 GPU decompressor output size:  62935280\n",
      "lz4 GPU compress/decompress round trip time:  0.02284073829650879\n",
      "31467644\n",
      "4\n",
      "4\n",
      "7866908\n",
      "lz4 GPU compressor output size:  31599109\n",
      "lz4 GPU decompressor output size:  31467632\n",
      "lz4 GPU compress/decompress round trip time:  0.015845537185668945\n",
      "15733822\n",
      "4\n",
      "4\n",
      "3933452\n",
      "lz4 GPU compressor output size:  15799573\n",
      "lz4 GPU decompressor output size:  15733808\n",
      "lz4 GPU compress/decompress round trip time:  0.009501934051513672\n",
      "7866911\n",
      "4\n",
      "4\n",
      "1966724\n",
      "lz4 GPU compressor output size:  7899801\n",
      "lz4 GPU decompressor output size:  7866896\n",
      "lz4 GPU compress/decompress round trip time:  0.011568546295166016\n",
      "3933455\n",
      "4\n",
      "4\n",
      "983360\n",
      "lz4 GPU compressor output size:  3949915\n",
      "lz4 GPU decompressor output size:  3933440\n",
      "lz4 GPU compress/decompress round trip time:  0.00696110725402832\n",
      "1966727\n",
      "4\n",
      "4\n",
      "491680\n",
      "lz4 GPU compressor output size:  1974981\n",
      "lz4 GPU decompressor output size:  1966720\n",
      "lz4 GPU compress/decompress round trip time:  0.012327194213867188\n",
      "983363\n",
      "4\n",
      "4\n",
      "245840\n",
      "lz4 GPU compressor output size:  987514\n",
      "lz4 GPU decompressor output size:  983360\n",
      "lz4 GPU compress/decompress round trip time:  0.006538867950439453\n",
      "491681\n",
      "4\n",
      "4\n",
      "122920\n",
      "lz4 GPU compressor output size:  493774\n",
      "lz4 GPU decompressor output size:  491680\n",
      "lz4 GPU compress/decompress round trip time:  0.012677907943725586\n",
      "245840\n",
      "4\n",
      "4\n",
      "61460\n",
      "lz4 GPU compressor output size:  246904\n",
      "lz4 GPU decompressor output size:  245840\n",
      "lz4 GPU compress/decompress round trip time:  0.006706953048706055\n",
      "122920\n",
      "4\n",
      "4\n",
      "30728\n",
      "lz4 GPU compressor output size:  123459\n",
      "lz4 GPU decompressor output size:  122912\n",
      "lz4 GPU compress/decompress round trip time:  0.010996580123901367\n",
      "61460\n",
      "4\n",
      "4\n",
      "15364\n",
      "lz4 GPU compressor output size:  61745\n",
      "lz4 GPU decompressor output size:  61456\n",
      "lz4 GPU compress/decompress round trip time:  0.006911039352416992\n",
      "30730\n",
      "4\n",
      "4\n",
      "7680\n",
      "lz4 GPU compressor output size:  30907\n",
      "lz4 GPU decompressor output size:  30720\n",
      "lz4 GPU compress/decompress round trip time:  0.004134178161621094\n",
      "15365\n",
      "4\n",
      "4\n",
      "3840\n",
      "lz4 GPU compressor output size:  15498\n",
      "lz4 GPU decompressor output size:  15360\n",
      "lz4 GPU compress/decompress round trip time:  0.0048847198486328125\n",
      "7682\n",
      "4\n",
      "4\n",
      "1920\n",
      "lz4 GPU compressor output size:  7787\n",
      "lz4 GPU decompressor output size:  7680\n",
      "lz4 GPU compress/decompress round trip time:  0.0031135082244873047\n",
      "3841\n",
      "4\n",
      "4\n",
      "960\n",
      "lz4 GPU compressor output size:  3940\n",
      "lz4 GPU decompressor output size:  3840\n",
      "lz4 GPU compress/decompress round trip time:  0.0027506351470947266\n"
     ]
    }
   ],
   "source": [
    "lz4_gpu_size = []\n",
    "lz4_gpu_temp_size = []\n",
    "lz4_gpu_round_trip_time = []\n",
    "for size in sizes:\n",
    "    data_host = get_host_data(size, DTYPE)\n",
    "    data_gpu = cp.array(data_host)\n",
    "\n",
    "    \"\"\"LZ4 GPU\"\"\"\n",
    "    data_gpu = cp.array(data_host)\n",
    "    t_gpu = time.time()\n",
    "    compressor = kvikio.nvcomp.LZ4Manager(dtype=data_gpu.dtype)\n",
    "    compressed = compressor.compress(data_gpu)\n",
    "    output_size = compressed.nbytes\n",
    "\n",
    "    decompressed = compressor.decompress(compressed)\n",
    "    decompressed_size = decompressed.size * decompressed.itemsize\n",
    "    lz4_gpu_round_trip_time.append(time.time() - t_gpu)\n",
    "    lz4_gpu_size.append(output_size)\n",
    "    print('lz4 GPU compressor output size: ', output_size)\n",
    "    print('lz4 GPU decompressor output size: ', decompressed_size)\n",
    "    print('lz4 GPU compress/decompress round trip time: ',time.time() - t_gpu)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "0b9e6efb-439b-4d9e-b221-1a728adee7d6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# zarr lz4 max buffer size is 264241152 int64s\n",
    "# zarr lz4 max buffer size is 2113929216 bytes\n",
    "# cascaded max buffer size is 2147483640 bytes\n",
    "# cascaded max buffer size is 268435456 int64s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "9cd69f83-88de-4929-b760-b8ebfb916b8f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2013929216, 1006964608, 503482304, 251741152, 125870576, 62935280, 31467632, 15733808, 7866896, 3933440, 1966720, 983360, 491680, 245840, 122912, 61456, 30720, 15360, 7680, 3840]\n",
      "[33434464, 16717276, 8358716, 4179436, 2089796, 1044976, 522532, 261344, 130716, 65436, 32796, 16476, 8316, 4236, 2184, 1148, 632, 360, 224, 156]\n",
      "[]\n",
      "[0.10751104354858398, 0.11756682395935059, 0.05767321586608887, 0.028416156768798828, 0.014620304107666016, 0.007331132888793945, 0.004427194595336914, 0.0025060176849365234, 0.0017902851104736328, 0.0016641616821289062, 0.001974821090698242, 0.0013790130615234375, 0.0011060237884521484, 0.0014438629150390625, 0.0010533332824707031, 0.0008640289306640625, 0.001127481460571289, 0.0014081001281738281, 0.0011692047119140625, 0.0012063980102539062]\n",
      "[2022340697, 1011170371, 505585200, 252792621, 126396327, 63198181, 31599109, 15799573, 7899801, 3949915, 1974981, 987514, 493774, 246904, 123459, 61745, 30907, 15498, 7787, 3940]\n",
      "[]\n",
      "[0.7270452976226807, 0.3670234680175781, 0.18999958038330078, 0.09043264389038086, 0.04634451866149902, 0.022789478302001953, 0.015785932540893555, 0.009443283081054688, 0.011508703231811523, 0.00690460205078125, 0.012271881103515625, 0.00648951530456543, 0.012626171112060547, 0.006663322448730469, 0.010945320129394531, 0.00687098503112793, 0.004094123840332031, 0.004844188690185547, 0.0030717849731445312, 0.0027098655700683594]\n",
      "[2021826967, 1010913478, 505456734, 252728362, 126364175, 63182074, 31591024, 15795499, 7897736, 3948855, 1974422, 987206, 493597, 246793, 123383, 61678, 30822, 15401, 7699, 3852]\n",
      "[4.681788921356201, 2.579982280731201, 1.2367866039276123, 0.5987403392791748, 0.3033754825592041, 0.16110515594482422, 0.1472797393798828, 0.03442859649658203, 0.010602712631225586, 0.028273344039916992, 0.0026633739471435547, 0.0007534027099609375, 0.0009970664978027344, 0.0004544258117675781, 0.0002968311309814453, 0.0002384185791015625, 0.00015044212341308594, 0.00044274330139160156, 0.00023889541625976562, 0.00026869773864746094]\n"
     ]
    }
   ],
   "source": [
    "print(input_size)\n",
    "print(cascaded_size)\n",
    "print(cascaded_temp_size)\n",
    "print(cascaded_round_trip_time)\n",
    "print(lz4_gpu_size)\n",
    "print(lz4_gpu_temp_size)\n",
    "print(lz4_gpu_round_trip_time)\n",
    "print(lz4_size)\n",
    "print(lz4_round_trip_time)\n",
    "df = pd.DataFrame({\n",
    "    'Input Size (Bytes)': input_size,\n",
    "    'cascaded_size': cascaded_size,\n",
    "    'cascaded_round_trip_time': cascaded_round_trip_time,\n",
    "    'lz4_gpu_size': lz4_gpu_size,\n",
    "    'lz4_gpu_round_trip_time': lz4_gpu_round_trip_time,\n",
    "    'lz4_size': lz4_size,\n",
    "    'lz4_round_trip_time': lz4_round_trip_time\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "c7a23383-a073-4156-9be6-9da6b8c9026e",
   "metadata": {},
   "outputs": [],
   "source": [
    "### You'll need the following to display the upcoming plots. ###\n",
    "\n",
    "# !conda install -c conda-forge plotly\n",
    "# !npm install require"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "8a7d2c60-79d7-4840-a5fb-c7e1eb42f829",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Index(['Input Size (Bytes)', 'cascaded_size', 'cascaded_round_trip_time',\n",
      "       'lz4_gpu_size', 'lz4_gpu_round_trip_time', 'lz4_size',\n",
      "       'lz4_round_trip_time', 'Cascaded Compression Ratio',\n",
      "       'Lz4 Gpu Compression Ratio', 'Lz4 Host Compression Ratio',\n",
      "       'Cascaded Speedup', 'Lz4 Gpu Speedup'],\n",
      "      dtype='object')\n"
     ]
    }
   ],
   "source": [
    "df['Cascaded Compression Ratio'] = df['Input Size (Bytes)'] / df['cascaded_size']\n",
    "df['Lz4 Gpu Compression Ratio'] = df['Input Size (Bytes)'] / df['lz4_gpu_size']\n",
    "df['Lz4 Host Compression Ratio'] = df['Input Size (Bytes)'] / df['lz4_size']\n",
    "df['Cascaded Speedup'] = df['lz4_round_trip_time'] / df['cascaded_round_trip_time']\n",
    "df['Lz4 Gpu Speedup'] = df['lz4_round_trip_time'] / df['lz4_gpu_round_trip_time']\n",
    "print(df.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "8c6f225a-61e6-42b2-a991-6eeab56aae48",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hovertemplate": "variable=Cascaded Speedup<br>Input Size (Bytes)=%{x}<br>Multiple Faster=%{y}<extra></extra>",
         "legendgroup": "Cascaded Speedup",
         "line": {
          "color": "#636efa",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines",
         "name": "Cascaded Speedup",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": [
          2013929216,
          1006964608,
          503482304,
          251741152,
          125870576,
          62935280,
          31467632,
          15733808,
          7866896,
          3933440,
          1966720,
          983360,
          491680,
          245840,
          122912,
          61456,
          30720,
          15360,
          7680,
          3840
         ],
         "xaxis": "x",
         "y": [
          43.54705123144407,
          21.94481567030547,
          21.444731065444667,
          21.07041934455389,
          20.75028537882,
          21.975478877361866,
          33.267057999892295,
          13.738369327371325,
          5.922359834864829,
          16.989541547277938,
          1.3486659422914402,
          0.5463347164591977,
          0.9014873895236042,
          0.31472919418758255,
          0.2818017202354006,
          0.27593818984547464,
          0.13343201522520617,
          0.3144260074500508,
          0.20432300163132136,
          0.22272727272727272
         ],
         "yaxis": "y"
        },
        {
         "hovertemplate": "variable=Lz4 Gpu Speedup<br>Input Size (Bytes)=%{x}<br>Multiple Faster=%{y}<extra></extra>",
         "legendgroup": "Lz4 Gpu Speedup",
         "line": {
          "color": "#EF553B",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines",
         "name": "Lz4 Gpu Speedup",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": [
          2013929216,
          1006964608,
          503482304,
          251741152,
          125870576,
          62935280,
          31467632,
          15733808,
          7866896,
          3933440,
          1966720,
          983360,
          491680,
          245840,
          122912,
          61456,
          30720,
          15360,
          7680,
          3840
         ],
         "xaxis": "x",
         "y": [
          6.439473491768513,
          7.029474967000302,
          6.5094175546732655,
          6.620843022182852,
          6.5460919936414195,
          7.069277927730003,
          9.329809246197762,
          3.645829125429206,
          0.9212777858341448,
          4.094854972375691,
          0.21703061858874728,
          0.11609537455453911,
          0.07896823898183467,
          0.06819808215256906,
          0.027119456303912173,
          0.03469933030292515,
          0.036745865362217564,
          0.09139679102273846,
          0.0777708786091276,
          0.09915537568185817
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "legend": {
         "title": {
          "text": "variable"
         },
         "tracegroupgap": 0
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "text": "Gpu Acceleration over Zarr Lz4 - Ascending <class 'numpy.int32'>"
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Input Size (Bytes)"
         },
         "type": "category"
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Multiple Faster"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "title = 'Gpu Acceleration over Zarr Lz4 - ' + TARGET + \" \" + str(DTYPE)\n",
    "subtitle = 'Includes host->gpu copy time'\n",
    "fig = px.line(df, x='Input Size (Bytes)',\n",
    "              y=['Cascaded Speedup', 'Lz4 Gpu Speedup'],\n",
    "              labels={'value': 'Multiple Faster'},\n",
    "              title=title)\n",
    "fig.update_xaxes(type='category')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "e3d57a90-ca86-41da-9747-696151d66184",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hovertemplate": "variable=Lz4 Gpu Compression Ratio<br>Input Size (Bytes)=%{x}<br>Compression Factor=%{y}<extra></extra>",
         "legendgroup": "Lz4 Gpu Compression Ratio",
         "line": {
          "color": "#636efa",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines",
         "name": "Lz4 Gpu Compression Ratio",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": [
          2013929216,
          1006964608,
          503482304,
          251741152,
          125870576,
          62935280,
          31467632,
          15733808,
          7866896,
          3933440,
          1966720,
          983360,
          491680,
          245840,
          122912,
          61456,
          30720,
          15360,
          7680,
          3840
         ],
         "xaxis": "x",
         "y": [
          0.9958407201059258,
          0.9958406979470327,
          0.995840669386683,
          0.9958405866601621,
          0.9958404566613712,
          0.9958400543205508,
          0.9958392181247895,
          0.9958375457362044,
          0.9958347052033336,
          0.9958290241688745,
          0.9958171749500375,
          0.9957934773582957,
          0.9957591934771778,
          0.9956906327965525,
          0.9955693793081104,
          0.9953194590655113,
          0.9939495907076067,
          0.9910956252419667,
          0.9862591498651598,
          0.9746192893401016
         ],
         "yaxis": "y"
        },
        {
         "hovertemplate": "variable=Cascaded Compression Ratio<br>Input Size (Bytes)=%{x}<br>Compression Factor=%{y}<extra></extra>",
         "legendgroup": "Cascaded Compression Ratio",
         "line": {
          "color": "#EF553B",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines",
         "name": "Cascaded Compression Ratio",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": [
          2013929216,
          1006964608,
          503482304,
          251741152,
          125870576,
          62935280,
          31467632,
          15733808,
          7866896,
          3933440,
          1966720,
          983360,
          491680,
          245840,
          122912,
          61456,
          30720,
          15360,
          7680,
          3840
         ],
         "xaxis": "x",
         "y": [
          60.23512792069884,
          60.23496938137529,
          60.23440729413465,
          60.23328315112374,
          60.231034990975196,
          60.226531518427215,
          60.2214448110355,
          60.20344067589078,
          60.183114538388566,
          60.11125374411639,
          59.96828881570923,
          59.68438941490653,
          59.12457912457913,
          58.035882908404155,
          56.27838827838828,
          53.53310104529617,
          48.607594936708864,
          42.666666666666664,
          34.285714285714285,
          24.615384615384617
         ],
         "yaxis": "y"
        },
        {
         "hovertemplate": "variable=Lz4 Host Compression Ratio<br>Input Size (Bytes)=%{x}<br>Compression Factor=%{y}<extra></extra>",
         "legendgroup": "Lz4 Host Compression Ratio",
         "line": {
          "color": "#00cc96",
          "dash": "solid"
         },
         "marker": {
          "symbol": "circle"
         },
         "mode": "lines",
         "name": "Lz4 Host Compression Ratio",
         "orientation": "v",
         "showlegend": true,
         "type": "scatter",
         "x": [
          2013929216,
          1006964608,
          503482304,
          251741152,
          125870576,
          62935280,
          31467632,
          15733808,
          7866896,
          3933440,
          1966720,
          983360,
          491680,
          245840,
          122912,
          61456,
          30720,
          15360,
          7680,
          3840
         ],
         "xaxis": "x",
         "y": [
          0.9960937552377597,
          0.9960937606571312,
          0.9960937705105339,
          0.9960937902173401,
          0.9960938375136782,
          0.9960939237290628,
          0.9960940803944817,
          0.9960943937257063,
          0.9960950834517639,
          0.996096336786233,
          0.9960991115374525,
          0.9961041565792752,
          0.9961162648881577,
          0.9961384642190013,
          0.9961826183509884,
          0.9964006615000487,
          0.996690675491532,
          0.9973378352055061,
          0.997532147032082,
          0.9968847352024922
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "legend": {
         "title": {
          "text": "variable"
         },
         "tracegroupgap": 0
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "title": {
         "text": "Compression - Ascending <class 'numpy.int32'>"
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Input Size (Bytes)"
         },
         "type": "category"
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "Compression Factor"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import plotly.express as px\n",
    "title = 'Compression - ' + TARGET + \" \" + str(DTYPE)\n",
    "fig = px.line(df, x='Input Size (Bytes)',\n",
    "              y=[\n",
    "                  'Lz4 Gpu Compression Ratio',\n",
    "                  'Cascaded Compression Ratio',\n",
    "                  'Lz4 Host Compression Ratio'\n",
    "              ],\n",
    "              labels={'value': 'Compression Factor'},\n",
    "              title=title)\n",
    "fig.update_xaxes(type='category')\n",
    "fig.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
